﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Midi;
using MIDIRemapper.DeviceInterfaces;

namespace MIDIRemapper
{
    partial class Form1
    {
        public Form1()
        {
            InitializeComponent();
            loadDeviceLists();
        }

        ~Form1()
        {
            di.UnloadInputDevice();
            di.UnloadOutputDevice();
        }

        private void loadDeviceLists()
        {

            DeviceInterface.ResetDeviceLists();
            inputsBox.Items.Clear();
            outputsBox.Items.Clear();
            int i_temp = 0;
            foreach (InputDevice id in InputDevice.InstalledDevices)
            {
                inputsBox.Items.Add((object)(String.Concat(i_temp, ": ", id.Name)));
                i_temp++;
            }
            i_temp = 0;
            foreach (OutputDevice od in OutputDevice.InstalledDevices)
            {
                outputsBox.Items.Add((object)(String.Concat(i_temp, ": ", od.Name)));
                i_temp++;
            }
        }
    }
}
